const http = require('../../http.js')
Component({
  mixins: [],
  data: {},
  props: {},
  didMount() {
    
  },
  didUpdate() {},
  didUnmount() {},
  methods: {
    listBtn(){
      if(!my.getStorageSync("token").data){//判断是否登录
        my.confirm({
          title: '温馨提示',
          content: '您还未授权登录，为了方便您的使用，请授权登录后在使用',
          confirmButtonText: '授权登录',
          cancelButtonText: '暂不需要',
          success: (result) => {
            if(result.confirm){
              my.getAuthCode({
                scopes: 'auth_base',
                success: ({ authCode }) => {
                  http.get('/api/alipay/aliLogin',{code:authCode}).then(res => {
                    if (res.code == 200) {
                      console.log(res)
                    }
                  })
                },
              });
              // my.navigateTo({
              //   url: 'plugin://myPlugin/auth',
              // });
            }else{
              my.navigateTo({
                url: 'plugin://myPlugin/user',
              });
            }
          },
        });
      }
    }
  }
});
